package com.example.hxpc.guidancemanagement.tools.dataTools;

import android.content.Context;

import com.example.hxpc.guidancemanagement.api.BaseApi;
import com.example.hxpc.guidancemanagement.model.ApiInfo;
import com.example.hxpc.guidancemanagement.tools.LogoutT;
import com.zhy.http.okhttp.OkHttpUtils;
import com.zhy.http.okhttp.callback.StringCallback;

import okhttp3.Call;

/**
 * Created by tao on 2017/11/26.
 * 网络请求
 */

public class OkHttpTools {
    private BaseApi baseApi;

    /**
     * 登录
     * @param phone 手机
     * @param password 密码
     * @param type 类型：1-管理员，2-超级用户，3-普通用户
     */
    public void login( Context context ,String phone ,String password){
//        this.baseApi = baseApi;
        OkHttpUtils
                .post()
                .url(ApiInfo.loginUrl)
                .addParams("phone",phone)
                .addParams("password",password)
                .build()
                .execute(new StringCallback() {
                    @Override
                    public void onError(Call call, Exception e, int id) {
//                        LogoutT.logout(e+"");
                    }

                    @Override
                    public void onResponse(String response, int id) {
//                        LogoutT.logout(response);

                    }
                });


    }

}
